package com.ztk.threadbasic.excel;

import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.event.AnalysisEventListener;
import org.apache.commons.compress.utils.Lists;

import java.util.List;

public class EasyExcelDemo2 {
    public static void main(String[] args) {
        List dataList = Lists.newArrayList();

        EasyExcel.read("D:\\学生信息表.xlsx", new AnalysisEventListener<List<Object>>() {
                    @Override
                    public void invoke(List<Object> listObj, AnalysisContext analysisContext) {
                        dataList.addAll(listObj);
                    }

                    @Override
                    public void doAfterAllAnalysed(AnalysisContext analysisContext) {
                        System.out.println("解析完成");
                    }
                }).sheet().doRead();

                dataList.forEach(System.out::println);

    }
}
